function ret = mixSignalsPatterns (vec)
	aux_cell_ones = {};
	aux_ones = [];
	aux_zeros = [];
	index_cell = 1;

	% transform vec to cells where a block of 3 or more ones will
	% converted into a single element of a cell.
	vecSize = rows(vec);
	i = 1;
	while (i <= vecSize)
		if (vec(i, 2) == 0)
			aux_cell_ones{index_cell} = vec(i, :);
			i++;
		else
			countOnes = 0;
			while (vec(i, 2) == 1)
				aux_ones =[aux_ones; vec(i, :)];
				countOnes++;
				i++;
			endwhile

			if (countOnes >= 3)
				aux_cell_ones{index_cell} = mixPatterns(aux_ones);
			else
				for j = 1: rows(aux_ones)
					aux_cell_ones{index_cell} = aux_ones(j, :);
					index_cell++;
				endfor
				index_cell--;
			endif
			aux_ones = [];
			%i = i + countOnes;
		endif

		index_cell++;
	endwhile

	%mixPatterns, and return
	ret = cellToMatrix(mixCell(aux_cell_ones));
endfunction